package com.ssy.lingxi.order.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 订单收货人信息
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-17
 */
@Entity
@Table(schema = "public", name = "ord_consignee", indexes = {@Index(name = "ord_consignee_order_id_idx", columnList = "order_id")})
public class OrderConsigneeDO implements Serializable {
    private static final long serialVersionUID = -7987879975663236339L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_consignee_seq")
    @SequenceGenerator(sequenceName = "ord_consignee_seq", name = "ord_consignee_seq", allocationSize = 1)
    private Long id;

    /**
     * 一对一双向关联订单
     */
    @JsonBackReference
    @OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name="order_id", referencedColumnName="id")
    private OrderDO order;

    /**
     * 收货人Id（来自物流服务）
     */
    @Column
    private Long consigneeId;

    /**
     * 收货人姓名
     */
    @Column(columnDefinition = "varchar(50)")
    private String consignee;

    /**
     * 省编码
     */
    @Column(columnDefinition = "varchar(10)")
    private String provinceCode;

    /**
     * 省名称
     */
    @Column(columnDefinition = "varchar(20)")
    private String provinceName;

    /**
     * 市编码
     */
    @Column(columnDefinition = "varchar(10)")
    private String cityCode;

    /**
     * 市名称
     */
    @Column(columnDefinition = "varchar(20)")
    private String cityName;

    /**
     * 区编码
     */
    @Column(columnDefinition = "varchar(10)")
    private String districtCode;

    /**
     * 区名称
     */
    @Column(columnDefinition = "varchar(20)")
    private String districtName;

    /**
     * 街道编码
     */
    @Column(columnDefinition = "varchar(10)")
    private String streetCode;

    /**
     * 街道名称
     */
    @Column(columnDefinition = "varchar(20)")
    private String streetName;

    /**
     * 详细地址
     */
    @Column(columnDefinition = "varchar(200)")
    private String address;

    /**
     * 邮政编码
     */
    @Column(columnDefinition = "varchar(20)")
    private String postalCode;

    /**
     * 国家编码（手机号码前缀）
     */
    @Column(columnDefinition = "varchar(10)")
    private String countryCode;

    /**
     * 手机号码
     */
    @Column(columnDefinition = "varchar(20)")
    private String phone;

    /**
     * 固定电话号码
     */
    @Column(columnDefinition = "varchar(20)")
    private String telephone;

    /**
     * 是否默认
     */
    @Column
    private Boolean defaultConsignee;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public OrderDO getOrder() {
        return order;
    }

    public void setOrder(OrderDO order) {
        this.order = order;
    }

    public Long getConsigneeId() {
        return consigneeId;
    }

    public void setConsigneeId(Long consigneeId) {
        this.consigneeId = consigneeId;
    }

    public String getConsignee() {
        return consignee;
    }

    public void setConsignee(String consignee) {
        this.consignee = consignee;
    }

    public String getProvinceCode() {
        return provinceCode;
    }

    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCityCode() {
        return cityCode;
    }

    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getDistrictCode() {
        return districtCode;
    }

    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode;
    }

    public String getDistrictName() {
        return districtName;
    }

    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }

    public String getStreetCode() {
        return streetCode;
    }

    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }

    public String getStreetName() {
        return streetName;
    }

    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPostalCode() {
        return postalCode;
    }

    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    public String getCountryCode() {
        return countryCode;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Boolean getDefaultConsignee() {
        return defaultConsignee;
    }

    public void setDefaultConsignee(Boolean defaultConsignee) {
        this.defaultConsignee = defaultConsignee;
    }
}
